#include <func.h>

int main(int argc,char **argv)
{
    int fds[2] = {0};
    pipe(fds);//0读1写
    char szBuf[32] = {'\0'};
    if(!fork())
    {
        //child
        close(fds[0]);
        write(fds[1],"hello",6);
        printf("parent: write done\n");
    }
    else
    {
        //parent
        close(fds[1]);
        wait(NULL);
        read(fds[0],szBuf,6);
        printf("child: receive \" %s \"from fd : %d\n",szBuf,fds[1]);
    }
    return 0;
}

